<html>
<head><meta charset="utf-8"><title>Are we comfortable with adding an insta-stable cfg(wasm)? · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html">Are we comfortable with adding an insta-stable cfg(wasm)?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233158441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233158441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233158441">(Apr 05 2021 at 10:49)</a>:</h4>
<p>In <a href="https://github.com/rust-lang/rust/pull/80525">https://github.com/rust-lang/rust/pull/80525</a> we added to nightly a <code>cfg(wasm)</code> which is set when either <code>wasm32</code> or <code>wasm64</code> targets are used. We don't have other top-level cfg values set for other targets, only for <code>windows</code> vs <code>unix</code> which operates based on the OS. This ended up being an insta-stable addition due to oversight of mine.</p>
<p>Please let me know if T-lang is not comfortable with this and we should back-out or make this cfg unstable.</p>



<a name="233158641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233158641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233158641">(Apr 05 2021 at 10:52)</a>:</h4>
<p>I personally am fine with adding it. And I think there's a value in having it available sooner rather than later, so that people can start using it in place of wasm32-specific cfg, even if wasm64 isn't there yet.</p>



<a name="233158671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233158671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233158671">(Apr 05 2021 at 10:53)</a>:</h4>
<p>It should have gone through lang review, but let's just do that now. Could you open an issue to review it, tag it T-lang, and rfcbot merge it?</p>



<a name="233159340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233159340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233159340">(Apr 05 2021 at 11:02)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/83879">https://github.com/rust-lang/rust/issues/83879</a> but rfcbot is not listening to me <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span></p>



<a name="233162474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233162474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233162474">(Apr 05 2021 at 11:47)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> I'm told that somebody from T-lang will need to kick off the fcp.</p>



<a name="233165237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233165237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233165237">(Apr 05 2021 at 12:25)</a>:</h4>
<p>It feels a bit weird having this for wasm32/wasm64 when we don't even have it for x86/x86_64.</p>



<a name="233165261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233165261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233165261">(Apr 05 2021 at 12:25)</a>:</h4>
<p>Or riscv32/riscv64. Or mips/mips64. Etc.</p>



<a name="233173698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233173698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233173698">(Apr 05 2021 at 13:47)</a>:</h4>
<p>I think wasm is somewhat unique in that there isn't actually a wasm32 and wasm64, that's just a weird llvm way of representing wasm's memory types. I think we should encourage people, when writing wasm code, to not write it specifically for 32 or 64</p>



<a name="233173796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233173796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233173796">(Apr 05 2021 at 13:48)</a>:</h4>
<p>also apologies for not realising this should be feature gated</p>



<a name="233173814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233173814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233173814">(Apr 05 2021 at 13:48)</a>:</h4>
<p>Then we should just have <code>target_arch = "wasm"</code>...</p>



<a name="233173844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233173844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233173844">(Apr 05 2021 at 13:48)</a>:</h4>
<p>Though it might be too late for that since <code>wasm32</code> is already stable.</p>



<a name="233173902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233173902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233173902">(Apr 05 2021 at 13:49)</a>:</h4>
<p>There's a similar discussion happening in <a href="https://github.com/rust-lang/stdarch/pull/974">https://github.com/rust-lang/stdarch/pull/974</a> about <code>core::arch::{wasm32,wasm64}</code>.</p>



<a name="233174056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174056">(Apr 05 2021 at 13:50)</a>:</h4>
<p>yeah, we'll see how that goes</p>



<a name="233174256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174256">(Apr 05 2021 at 13:52)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116015">@Alex Crichton</span></p>



<a name="233174388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174388">(Apr 05 2021 at 13:53)</a>:</h4>
<p>I'm not sure target_arch="wasm" would be possible without making an exception in the cfg compare code which seems very messy</p>



<a name="233174481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174481">(Apr 05 2021 at 13:54)</a>:</h4>
<p>Personally I'd agree that this should be unstable to start, wasm64 I think is not necessarily pressing enough to stabilize something like this quickly. I also agree with the sentiment that this isn't present for any other architectures either</p>



<a name="233174528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174528">(Apr 05 2021 at 13:54)</a>:</h4>
<p>Er sorry, should not be stable that is</p>



<a name="233174559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174559">(Apr 05 2021 at 13:55)</a>:</h4>
<p>Nvmd it's early I need to wake up</p>



<a name="233174623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174623">(Apr 05 2021 at 13:55)</a>:</h4>
<p>zulip's lack of blobmorning emoji is disturbing</p>



<a name="233174744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233174744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233174744">(Apr 05 2021 at 13:56)</a>:</h4>
<p>I agree it's fine for this to be unstable, wasm64 target doesn't even support core yet, no rush <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="233205262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205262">(Apr 05 2021 at 17:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> So, I agree that wasm64 itself isn't super time-sensitive. But is there any reason not to have <code>cfg(wasm)</code> that matches wasm32, for now, so that people can start writing size-independent wasm code?</p>



<a name="233205292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205292">(Apr 05 2021 at 17:49)</a>:</h4>
<p>(I don't object to it being feature-gated for a while, but I think there's value in stabilizing it in a timely fashion, before we have full wasm64.)</p>



<a name="233205488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205488">(Apr 05 2021 at 17:51)</a>:</h4>
<p>Q: what does <code>cfg(wasm)</code> _really_ get us over <code>cfg(any(target_arch="wasm32", target_arch="wasm64"))</code> like what size-independent code for every other size-independent architecture has to do?</p>



<a name="233205493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205493">(Apr 05 2021 at 17:51)</a>:</h4>
<p>I kicked off a <span class="user-group-mention" data-user-group-id="1977">@T-lang</span> consensus check on <a href="https://github.com/rust-lang/rust/issues/83879">https://github.com/rust-lang/rust/issues/83879</a> for adding this behind a feature-gate.</p>



<a name="233205666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205666">(Apr 05 2021 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> What does <code>cfg(windows)</code> really get us over listing individual Windows targets? I think there's value in having an obvious, simple way to do it.</p>



<a name="233205673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205673">(Apr 05 2021 at 17:52)</a>:</h4>
<p>I don't recall it ever being brought up as a genuine pain point by anybody (if we ignore myself complaining internally that its awfully lot amount of typing)</p>



<a name="233205801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233205801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233205801">(Apr 05 2021 at 17:53)</a>:</h4>
<p>I always considered <code>cfg(windows)</code> and more importantly the definition of <code>cfg(unix) = cfg(not(windows))</code> to be sketchy.</p>



<a name="233206102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233206102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233206102">(Apr 05 2021 at 17:55)</a>:</h4>
<p>For x86, x86-64 is older than Rust, and it's the more popular architecture, so when people first wrote their cfg expressions, they knew to cover both (if they supported both).</p>
<p>For wasm32 and wasm64, wasm64 is much newer, and there was <em>only</em> wasm32 for a long time, so there's a lot of code out there that just checks for <code>wasm32</code>. That means people have to change their cfg expressions anyway, and having a low-friction thing to change them to that gets the answer right seems helpful to me.</p>



<a name="233206106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233206106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233206106">(Apr 05 2021 at 17:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233205801">said</a>:</p>
<blockquote>
<p>I always considered <code>cfg(windows)</code> and more importantly the definition of <code>cfg(unix) = cfg(not(windows))</code> to be sketchy.</p>
</blockquote>
<p>That definition is not true. wasm32-wasi for example is neither unix nor windows. Proof: compiling rustc to wasm32-wasi requires changing some functions with only <code>#[cfg(unix)]</code> and <code>#[cfg(windows)]</code> variants to add a new variant for wasm32-wasi to prevent rustc from complaining that the functions don't exist.</p>



<a name="233206286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233206286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233206286">(Apr 05 2021 at 17:57)</a>:</h4>
<p>In case of wasm32/wasm64 the only difference is the pointer size AFAICT. In case of x86/x86_64 there are instructions missing in x86.</p>



<a name="233206509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233206509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233206509">(Apr 05 2021 at 17:58)</a>:</h4>
<p>I think that's accurate. In particular, I think it's possible to write a single piece of wasm code that uses both 32-bit and 64-bit memories. The distinct targets are more helpful for toolchains (like LLVM and Rust) where they need a concept of "what's a pointer".</p>



<a name="233206621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233206621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233206621">(Apr 05 2021 at 17:59)</a>:</h4>
<p>I think there'd be some value in making a wasm target that can work with both, but that'd be a lot of toolchain work.</p>



<a name="233207059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233207059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233207059">(Apr 05 2021 at 18:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233206106">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233205801">said</a>:</p>
<blockquote>
<p>I always considered <code>cfg(windows)</code> and more importantly the definition of <code>cfg(unix) = cfg(not(windows))</code> to be sketchy.</p>
</blockquote>
<p>That definition is not true. wasm32-wasi for example is neither unix nor windows. Proof: compiling rustc to wasm32-wasi requires changing some functions with only <code>#[cfg(unix)]</code> and <code>#[cfg(windows)]</code> variants to add a new variant for wasm32-wasi to prevent rustc from complaining that the functions don't exist.</p>
</blockquote>
<p>Oh it changed since? It was defined that way in the past.</p>



<a name="233207566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233207566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233207566">(Apr 05 2021 at 18:05)</a>:</h4>
<p><code>none</code> targets are also neither <code>windows</code> nor <code>unix</code></p>



<a name="233207760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233207760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233207760">(Apr 05 2021 at 18:07)</a>:</h4>
<p>Yeah, I don't think they're defined as negations of each other.</p>



<a name="233207780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233207780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233207780">(Apr 05 2021 at 18:07)</a>:</h4>
<p>I <em>am</em> surprised that wasi isn't considered <code>cfg(unix)</code>, though.</p>



<a name="233215361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233215361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233215361">(Apr 05 2021 at 19:08)</a>:</h4>
<p>Both <code>cfg(unix|windows)</code> and <code>cfg(wasm)</code> seems pretty random.</p>
<p>I'm not sure what is the benefit of the former over <code>#[cfg(target_family = "unix|windows")]</code>, and the latter is <code>#[cfg(target_arch_family = "wasm")]</code> I guess (if it existed)?</p>



<a name="233215743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233215743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233215743">(Apr 05 2021 at 19:11)</a>:</h4>
<p>Would it be useful to introduce arch families for other architectures?</p>



<a name="233215809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233215809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233215809">(Apr 05 2021 at 19:12)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> Possibly. I'd certainly favor having a few more aliases for common cases.</p>



<a name="233216569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233216569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233216569">(Apr 05 2021 at 19:18)</a>:</h4>
<p>I don't personally see a reason to <em>not</em> add <code>cfg(wasm)</code> other than "it probably needs some discussion". In isolation I would personally be in favor of adding it (and any other conveniences for other architectures)</p>



<a name="233216597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233216597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233216597">(Apr 05 2021 at 19:18)</a>:</h4>
<p>e.g. if someone asked for the x86 equivalent I'd be fine adding it, although I wouldn't push for it mysefl</p>



<a name="233469645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233469645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233469645">(Apr 07 2021 at 11:16)</a>:</h4>
<blockquote>
<p>For x86, x86-64 is older than Rust, and it's the more popular architecture, so when people first wrote their cfg expressions, they knew to cover both (if they supported both).</p>
</blockquote>
<p>That seems like a pretty weak argument to me, since it is based entirely on historical accidents, not on what is a reasonable final design to end up with.</p>
<p>IMO if we want to have an easier to say "this architecture/target but I don't care if 32bit or 64bit", we should do that consistently across architectures, not just have something ad-hoc for wasm.</p>



<a name="233471324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233471324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Connor Horman <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233471324">(Apr 07 2021 at 11:32)</a>:</h4>
<p>I'd also add that the ability to detect both at once has been available in other languages for a while (possibly as long as x86_64 has been a compilation target). For example, gcc and clang define the macro <code>__i386__</code> when compiling to an i386 target, or to x86_64 IIRC (not saying I've relied upon this but <span aria-label="flushed" class="emoji emoji-1f633" role="img" title="flushed">:flushed:</span>). I believe MSVC has an equivalent to the same effect.</p>



<a name="233518938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233518938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233518938">(Apr 07 2021 at 16:17)</a>:</h4>
<p>I have no objections to adding cfg(x86), personally. I was making the case for why wasm in particular needed one, not why x86 didn't.</p>



<a name="233519954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233519954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233519954">(Apr 07 2021 at 16:24)</a>:</h4>
<p>I think it makes sense to explore the design space for all the architectures at once, rather than think about just wasm now and then think whether we want the same for other architectures.</p>



<a name="233520182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233520182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233520182">(Apr 07 2021 at 16:25)</a>:</h4>
<p><code>cfg(wasm)</code> to me makes sense to me right now only if we say that we definitely want this for wasm, but maybe not the other architectures.</p>
<p>Thinking about it now, its also is a breaking change to introduce bare <code>cfg(variables)</code>s – another thing I had forgotten.</p>



<a name="233520270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233520270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233520270">(Apr 07 2021 at 16:26)</a>:</h4>
<p>(e.g. a person may be setting <code>--cfg=wasm</code> for other purposes)</p>



<a name="233521617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233521617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233521617">(Apr 07 2021 at 16:34)</a>:</h4>
<p>Huh, I didn't realize that you could set top-level values and not just features.</p>



<a name="233521682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233521682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233521682">(Apr 07 2021 at 16:34)</a>:</h4>
<p>That's unfortunate. Though since cargo doesn't expose that, it might not be commonly used.</p>



<a name="233533115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233533115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233533115">(Apr 07 2021 at 17:50)</a>:</h4>
<p>I believe you can via a <a href="https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-cfgkeyvalue">build script</a>.</p>



<a name="233536038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233536038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233536038">(Apr 07 2021 at 18:07)</a>:</h4>
<p>With that in mind, I'm going to prepare a PR that removes this for now, we can decide on a mechanism to <code>cfg</code>-match on multiple architectures more easily outside of <code>cfg(wasm)</code> in particular.</p>



<a name="233551424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233551424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233551424">(Apr 07 2021 at 19:57)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/83981">https://github.com/rust-lang/rust/pull/83981</a></p>



<a name="233553624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233553624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233553624">(Apr 07 2021 at 20:12)</a>:</h4>
<p>apparently cfg(wasm) is a breaking change so it has to be removed instead of adding a feature flag. what would some alternatives be?</p>



<a name="233553704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233553704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233553704">(Apr 07 2021 at 20:13)</a>:</h4>
<p>oh i hate how zulip splits threads up, you always miss the last few messages</p>



<a name="233554434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233554434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233554434">(Apr 07 2021 at 20:18)</a>:</h4>
<p>i wonder how common this is <a href="https://github.com/katharostech/skipngo/blob/master/build.rs">https://github.com/katharostech/skipngo/blob/master/build.rs</a></p>



<a name="233554767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233554767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233554767">(Apr 07 2021 at 20:21)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> Thanks for staying on top of this.</p>



<a name="233554814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233554814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233554814">(Apr 07 2021 at 20:21)</a>:</h4>
<p>We may end up needing to add a more labeled "family" mechanism for this instead, rather than a top-level cfg alias.</p>



<a name="233555065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555065">(Apr 07 2021 at 20:23)</a>:</h4>
<p>ugh i really don't want to deal with like seven years of making a generalized rfc for all 1000 targets</p>



<a name="233555246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555246">(Apr 07 2021 at 20:24)</a>:</h4>
<p>I definitely wouldn't want to have <em>that</em> happen. I'm thinking more about the existing <code>target_family</code> mechanism.</p>



<a name="233555258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555258">(Apr 07 2021 at 20:25)</a>:</h4>
<p><a href="https://doc.rust-lang.org/reference/conditional-compilation.html#target_family">https://doc.rust-lang.org/reference/conditional-compilation.html#target_family</a></p>



<a name="233555292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555292">(Apr 07 2021 at 20:25)</a>:</h4>
<p>So a couple of alternatives that come to mind are:</p>
<ul>
<li>Some sort of alias system for <code>target_arch</code> and similar identifiers;</li>
<li>Reserve a number of potentially interesting keys such as <code>target_family</code> and similar on the edition boundary.</li>
</ul>



<a name="233555322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555322">(Apr 07 2021 at 20:25)</a>:</h4>
<p>Oh we have <code>target_family=*</code>? Even better</p>



<a name="233555343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555343">(Apr 07 2021 at 20:25)</a>:</h4>
<p>Yeah, I think we should just add <code>target_family = "wasm"</code>.</p>



<a name="233555429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555429">(Apr 07 2021 at 20:26)</a>:</h4>
<p>Yeah That seems very uncontroversial to me.</p>



<a name="233555577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555577">(Apr 07 2021 at 20:27)</a>:</h4>
<p>i feel like target_family would be wasi, not wasm</p>



<a name="233555840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555840">(Apr 07 2021 at 20:28)</a>:</h4>
<p><span class="user-mention" data-user-id="219805">@devsnek</span> Not all wasm targets are wasi targets. We could have both.</p>



<a name="233555894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233555894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233555894">(Apr 07 2021 at 20:29)</a>:</h4>
<p>According to its current usage and definition, sure. But "family" as a name is generic enough that changing its definition a little to make it "just" a grouping mechanism for various different <code>target_</code> cfgs sounds very feasible.</p>



<a name="233556219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233556219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233556219">(Apr 07 2021 at 20:31)</a>:</h4>
<p>i guess wasi can be target_os or smth</p>



<a name="233556248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233556248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233556248">(Apr 07 2021 at 20:31)</a>:</h4>
<p>do i need to make an rfc for adding a wasm target_family, or a feature flag or smth</p>



<a name="233556993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233556993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233556993">(Apr 07 2021 at 20:36)</a>:</h4>
<p>In the past new values for other <code>target_*</code> keys didn't require much scrutiny and were added as insta-stable alongside the targets (and their stability is really tied to target stability which is defined by <span class="user-mention" data-user-id="239881">@Josh Triplett</span>'s RFC)</p>



<a name="233557098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233557098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233557098">(Apr 07 2021 at 20:37)</a>:</h4>
<p><code>target_family</code> is only slightly different in that adding a new value to it also involves changing its definition in the reference slightly, which can be handled by a <code>fcp</code> vote on the PR itself.</p>



<a name="233559797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233559797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233559797">(Apr 07 2021 at 20:58)</a>:</h4>
<p>Sounds good. I think an FCP will be more than enough.</p>



<a name="233566492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233566492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> devsnek <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233566492">(Apr 07 2021 at 21:28)</a>:</h4>
<p>if its just adding os_family prop, can you include that in your pr @nagisa? if not i can find time at some point...</p>



<a name="233572814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233572814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233572814">(Apr 07 2021 at 22:26)</a>:</h4>
<p>I'm happy to make a PR later (probably sometime this weekend)</p>



<a name="233773369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233773369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233773369">(Apr 09 2021 at 06:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233521617">said</a>:</p>
<blockquote>
<p>Huh, I didn't realize that you could set top-level values and not just features.</p>
</blockquote>
<p>You can actually (ab)use this to have "features" in a crate that are impossible for outsiders to enable (but that your <a href="http://build.rs">build.rs</a> can enable).</p>



<a name="233773384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233773384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233773384">(Apr 09 2021 at 06:20)</a>:</h4>
<p>you can also just plain screw up the build because you can make <em>any</em> expression true, even false things</p>



<a name="233773427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233773427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233773427">(Apr 09 2021 at 06:20)</a>:</h4>
<p>but that's of low value since it mostly just crashes the build</p>



<a name="233937558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233937558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233937558">(Apr 10 2021 at 08:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233555246">said</a>:</p>
<blockquote>
<p>I definitely wouldn't want to have <em>that</em> happen. I'm thinking more about the existing <code>target_family</code> mechanism.</p>
</blockquote>
<p>docs say "Key-value option set at most once with the target's operating system value"<br>
so the "at most once" would be changed and we'd also set e.g. "wasm" or "x86" or so?</p>



<a name="233937574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233937574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233937574">(Apr 10 2021 at 08:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="224471">Lokathor</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233773369">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233521617">said</a>:</p>
<blockquote>
<p>Huh, I didn't realize that you could set top-level values and not just features.</p>
</blockquote>
<p>You can actually (ab)use this to have "features" in a crate that are impossible for outsiders to enable (but that your <a href="http://build.rs">build.rs</a> can enable).</p>
</blockquote>
<p>e.g. memoffset uses this to detect the current rustc version and use the "least incorrect" implementation of offset_of that is possible on that version. that seems like a reasonable use of this feature to me.</p>



<a name="233984795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233984795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233984795">(Apr 10 2021 at 20:34)</a>:</h4>
<p>There's an implementation of this at <a href="https://github.com/rust-lang/rust/pull/84072">https://github.com/rust-lang/rust/pull/84072</a></p>



<a name="233984800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233984800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233984800">(Apr 10 2021 at 20:34)</a>:</h4>
<p>and <a href="https://github.com/rust-lang/reference/pull/1006">https://github.com/rust-lang/reference/pull/1006</a></p>



<a name="233986390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Are%20we%20comfortable%20with%20adding%20an%20insta-stable%20cfg%28wasm%29%3F/near/233986390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg(wasm).3F.html#233986390">(Apr 10 2021 at 20:58)</a>:</h4>
<p>Kicked off FCP to confirm consensus.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>